<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 用户输入一个数字 计算3/2+...+n+1/n的和 */
        var n = prompt("请输入一个数：", );
        var add = 0;
        for(var i = 2; i <= n; i++) {
            add += (i + 1) / i;
        }
        alert("3/2+...+(n+1)/n的和:" + add);
        
    </script>
</body>
</html>